<?php
/**
 * 医嘱上传接口
* @authors xiadx (xiadx@zpdchina.com)
* @date    2017-03-02 16:29:31
* @version $Id$
*/

class YizhuhistorydatauploadController extends Yaf_Controller_Abstract {

	public function indexAction()
	{
		$yiyuan_id = $this->getRequest()->getPost("yiyuan_id", '');
		if($yiyuan_id === "" )
		{
			Utility::apiJsonError(20028, '请输入医院ID');
		}
		elseif(!ctype_digit("$yiyuan_id"))
		{
			Utility::apiJsonError(20027, '医院ID必须是整型');
		}
		$compression_http_data = $this->getRequest()->getPost("compression_http_data", 'off');
		$data = $this->getRequest()->getPost("data", null);
		if(empty($data)){
			Utility::apiJsonError('51001','缺少医嘱操作数据');
		}
		

		
		//		$user_department_id = $this->getRequest()->getPost("user_department_id", null);
		//		if(empty($user_department_id)){
		//			Utility::apiJsonError('51000','缺少科室信息');
		//		}
		$online_submit_data = $this->getRequest()->getPost("online_submit_data", 'on');
		$data = Utility::uncompress($data, $compression_http_data);
		// 		$user_department_id = $this->getRequest()->getPost("user_department_id", '');
		// 		$user_number = $this->getRequest()->getPost("user_number", 'on');
		// 		$shebei_id = $this->getRequest()->getPost("shebei_id", 'on');

		$upload_data = json_decode($data,true);

		$model = new YizhuHistoryModel();
		$re = $model->yizhuHistory($upload_data, $online_submit_data, $yiyuan_id);

		Utility::apiJsonResult($re, "", $compression_http_data);

	}

}
